local assets = {
	Asset("ANIM", "anim/stalker_shield.zip")
}

local function fn()
	local inst = CreateEntity()

	inst.entity:AddTransform()
	inst.entity:AddAnimState()
	inst.entity:AddSoundEmitter()
	inst.entity:AddNetwork()

	inst:AddTag("FX")

	local n = math.random(4)

	inst.AnimState:SetBank("stalker_shield")
	inst.AnimState:SetBuild("stalker_shield")
	inst.AnimState:PlayAnimation("idle" .. tostring(math.min(3, n)))
	inst.AnimState:SetFinalOffset(2)
	inst.AnimState:SetScale(1.18, 1.18, 1.18)

	inst.entity:SetPristine()

	if not TheWorld.ismastersim then
		return inst
	end

	inst.SoundEmitter:PlaySound("dontstarve/creatures/together/stalker/shield")

	inst.persists = false
	inst:ListenForEvent("animover", inst.Remove)
	inst:DoTaskInTime(inst.AnimState:GetCurrentAnimationLength() + FRAMES, inst.Remove)

	return inst
end

return Prefab("musha_shadowshield", fn, assets)
